Socket
Socket
Sign inDemoInstall

react-attr-converter

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-attr-converter

Convert HTML attribute names to React props


Version published
Weekly downloads
27K
decreased by-25.75%
Maintainers
1
Weekly downloads
 
Created
Source

react-attr-converter travis-ci

Convert HTML attribute names to React props.

Convert how?

It converts HTML attribute names into prop names used by React.

convert('class'); // => 'className'
convert('for'); // => 'htmlFor'
convert('onclick'); // => 'onClick'
convert('onCLICK'); // => 'onClick'

It bypasses attribute names which are not supported by React.

convert('data-hello'); // => 'data-hello'
convert('lovelive'); // => 'lovelive'

How to use

Install with NPM:

npm i --save react-attr-converter

Import with CommonJS or whatever:

const convert = require('react-attr-converter');

import convert from 'react-attr-converter';
import * as convert from 'react-attr-converter'; // both of them work

A bug!

When a bug is found, please report them in Issues.

Also, any form of contribution(especially a PR) will absolutely be welcomed :beers:

License

MIT

Keywords

FAQs

Package last updated on 12 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc